# -*- coding: utf-8 -*-
import unittest
from WebUIBaseTest import WebUIBaseTest


class TestCase(WebUIBaseTest):
    def test_case(self):
        driver = self.driver
        driver.get("https://www.baidu.com")
        driver.find_element_by_id("kw").click()
        driver.find_element_by_id("kw").clear()
        driver.find_element_by_id("kw").send_keys("selenium")
        driver.find_element_by_xpath("//*[@id=\"su\"]").click()
        try:
            self.assertEqual(u"selenium_百度搜索", driver.title)
        except AssertionError as e:
            self.verificationErrors.append(str(e))
        self.assertEqual(u"selenium_百度搜索", driver.title)
        self.assertEqual(u"selenium_百度搜索", driver.title)
        driver.find_element_by_link_text(u"Selenium_百度百科").click()
        # ERROR: Caught exception [ERROR: Unsupported command [selectWindow | win_ser_1 | ]]
        driver.find_element_by_xpath("//h2").click()
        # ERROR: Caught exception [ERROR: Unsupported command [doubleClick | //h2 | ]]
        self.assertEqual(u"（浏览器自动化测试框架）", driver.find_element_by_xpath("//h2").text)


if __name__ == "__main__":
    unittest.main()
